-
Notifications
You must be signed in to change notification settings - Fork 426
feat(bedrock_agent): add new Amazon Bedrock Agents Functions Resolver #6564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6564 +/- ##
===========================================
+ Coverage 96.12% 96.15% +0.02%
===========================================
Files 253 255 +2
Lines 12104 12240 +136
Branches 902 909 +7
===========================================
+ Hits 11635 11769 +134
- Misses 369 370 +1
- Partials 100 101 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Ana Falcão <[email protected]>
…tools/powertools-lambda-python into feat/bedrock_functions
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @anafalcao! I finished the first review and we need to fix the parameters part before proceeding with another review. Can you please work on that?
"response": { | ||
"actionGroup": event.action_group, | ||
"function": event.function, | ||
"functionResponse": {"responseBody": {"TEXT": {"body": str(body if body is not None else "")}}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response_state: str | None = None, | ||
) -> None: | ||
if response_state is not None and response_state not in ["FAILURE", "REPROMPT"]: | ||
raise ValueError("responseState must be None, 'FAILURE' or 'REPROMPT'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError("responseState must be None, 'FAILURE' or 'REPROMPT'") | |
raise ValueError("responseState must be 'FAILURE' or 'REPROMPT'") |
session_attributes: dict[str, str] | None = None, | ||
prompt_session_attributes: dict[str, str] | None = None, | ||
knowledge_bases: list[dict[str, Any]] | None = None, | ||
response_state: str | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense this field be a Literal of FAILURE AND REPROMPT and then give the customer a type hint in their IDE.
if not description: | ||
raise ValueError("Tool description is required") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description
parameter can be "None", but is it mandatory here? Is the description
mandatory to register a route? If not, I think we should not check this here.
if function_name in self._tools: | ||
raise ValueError(f"Tool '{function_name}' already registered") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I don't think we should raise here, but instead warning and register the most recent route.
function_name = self.current_event.function | ||
|
||
try: | ||
result = self._tools[function_name]["function"]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A critical part of this agent's workflow is passing parameters to functions. These parameters contain values that will be useful for the function in question. In this discussion, we talk about this:
Support for injecting parameters into the function signature.
Can you pls add this support?
Issue number:
#6300
Summary
This PR introduces support for Bedrock Agents Functions, providing the user a similar experience from the current Bedrock Agents with OpenAPI Resolver.
Changes
User experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.